#ifndef __SNACK_H__
#define __SNACK_H__
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<conio.h>
#include<Windows.h>
#include<time.h>


#define SnackMAXlen 450


enum difficulty
{
	easy=1,
	hard=2,
	nightmare=3
};


enum direction
{
	stop = 0,
	up = 119,//119
	left = 97,//97
	down = 115,//115
	right = 100,//100
	ESC=27
};


struct snack
{
	short SnackSpeed;//100ms
	char SnackLen;
	enum direction direction;
	enum direction ReverseDirection;
	char (*snack_coordinate)[2];
};



struct player
{
	char name[20];
	int ranking;
	long time;
};

struct fruit
{
	int fruit_x;
	int fruit_y;
};

struct snack_game
{
	int screen_x;
	int screen_y;
	char OneFruitsMark;
	char IsHaveFruit;
	enum difficulty Difficulty;
	struct player Player;
	struct snack Snack;
	struct fruit fruit;
};



void Intisnack_games(struct snack_game* snack_game);
void Intisnack_player(struct snack_game* snack_game);
void Intiscreen(char**screen, struct snack_game* snack_game);
void displayScreen(const char* screen, const struct snack_game* snack_game);
void PetSanckToscreen(char* screen, struct snack_game* snack_game);
void MoveSnack(struct snack_game* snack_game);
void ISchage(struct snack_game* snack_game);
void chagedirection(struct snack_game* snack_game);

void PetFruitToscreen( char* screen,  struct snack_game* snack_game);
int IsEatOrdie(struct snack_game* snack_game);

#endif // !__SNACK_H__
